#include<cstdio>
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
int main()
{
    //FILE*file=fopen("log.txt","w");
    //if(file==nullptr)
    //{
    //    perror("fopen fail:");
    //}
    //int cnt=10;
    //for(int i=0;i<cnt;i++)
    //{
    //    char buffer[128];
    //    snprintf(buffer,sizeof(buffer),"%d\n",i);
    //    fwrite(buffer,strlen(buffer),1,file);
    //}

    //fclose(file);
    
    FILE*fp=fopen("log.txt","r");
    while(1)
    {
        char buffer[128];
        memset(buffer,0,sizeof(buffer));
       int n= fread(buffer,1,1,fp);
        if(n)
        {
            printf("%s\n",buffer);
        }
        if(feof(fp))
            break;
        
    }
    fclose(fp);
    return 0;
}
